<?php

class GamesController extends Phalcon\Mvc\Controller
{
	// Validate if logged in before doing anything else
	public function initialize() {
		if (!$this->session->has("player")) {
			$this->response->redirect("/", true);
		}
		$this->view->setVar("player", $this->session->get("player"));
	}

	// Display the "games list" page
	public function indexAction() {
		return $this->listAction();
	}

	// Display the "list" of open games
	public function listAction() {
	}

	// Logs the user out and redirects him to the login page
	public function logoutAction() {
		$this->session->destroy();
		$this->response->redirect("index/index", true);
	}
}
